<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>用户修改</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/layui/css/layui.css">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
</head>
<body>
<form class="layui-form" action="" lay-filter="example">
    <div class="layui-form-item">

        <div class="layui-form-item">
            <div class="layui-form-item">
                <label class="layui-form-label">领取ID</label>
                <div class="layui-input-inline">
                    <input type="text" name="id" readonly autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">乘客ID</label>
                <div class="layui-input-inline">
                    <input type="text" name="passenger_id" readonly autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">手机号</label>
                <div class="layui-input-inline">
                    <input type="text" name="phone_number" readonly autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">优惠价类型</label>
                <div class="layui-input-inline">
                    <!--                    <input type="text" name="coupon_type" readonly autocomplete="off" class="layui-input">-->
                    <select name="coupon_type">
                        <option value="1" disabled>现金券</option>
                        <option value="2" disabled>专项券-免费送车券</option>
                        <option value="3" disabled>专项券-免费还车券</option>
                        <option value="4" disabled>折扣券</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">注册时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="enable_time" readonly autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">注册时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="expire_time" readonly autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
    </div>
</form>
</body>

<script src="/layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->
<script>
    layui.use(['form', 'layedit', 'laydate', 'upload', 'element'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , upload = layui.upload
            , laydate = layui.laydate
            , element = layui.element
            , $ = layui.jquery

        // 对页面中的表单进行默认渲染
        form.render();
        laydate.render({
            elem: '#date1',
            type: 'datetime',
            format: 'yyyy-MM-dd HH:mm:ss'
        });
        laydate.render({
            elem: '#date2',
            format: 'yyyy-MM-dd HH:mm:ss',
            type: 'datetime', //显示月份   year  显示到年
            // type: 'datetime',
        });
        // 通过ajax 对表单中内容进行赋值
        $.ajax({
            url: "/couponAdmin/getByDate"
            , dataType: "json"
            // 使用js的全局变量 parent.变量名
            , data: {id: parent.couponShowId}
            , success: function (data) {
                // 请求后端成功后，将查询的数据设置道页面中
                if (data.code == 200) {
                    // responseData { code:"" ; msg:"" ; data:"" }
                    form.val('example', {
                        "passenger_id": data.data.passenger_id
                        , "phone_number": data.data.phone_number
                        , "coupon_type": data.data.coupon_type
                        , "enable_time": data.data.enable_time
                        , "expire_time": data.data.expire_time
                        , "id": parent.couponShowId
                    });
                }
            }
        })
    });
</script>
</html>